﻿// Decompiled with JetBrains decompiler
// Type: MCM.Abstractions.SettingsDefinition
// Assembly: MCMv5, Version=5.10.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 7AB326B9-B2B4-41C2-9177-68E944071101
// Assembly location: D:\steam\steamapps\workshop\content\261550\2859238197\bin\Win64_Shipping_Client\MCMv5.dll

using MCM.Abstractions.Base;
using System.Collections.Generic;

#nullable enable
namespace MCM.Abstractions
{
  public class SettingsDefinition
  {
    public string SettingsId { get; }

    public string DisplayName { get; }

    public List<SettingsPropertyGroupDefinition> SettingPropertyGroups { get; }

    public SettingsDefinition(string id)
    {
      this.SettingsId = id;
      BaseSettings settings = BaseSettingsProvider.Instance?.GetSettings(id);
      this.DisplayName = settings?.DisplayName ?? "ERROR";
      this.SettingPropertyGroups = (settings != null ? settings.GetSettingPropertyGroups() : (List<SettingsPropertyGroupDefinition>) null) ?? new List<SettingsPropertyGroupDefinition>();
    }

    public SettingsDefinition(
      string id,
      string displayName,
      List<SettingsPropertyGroupDefinition> settingsPropertyGroups)
    {
      this.SettingsId = id;
      this.DisplayName = displayName;
      this.SettingPropertyGroups = settingsPropertyGroups;
    }

    public SettingsDefinition(
      string id,
      string displayName,
      IEnumerable<SettingsPropertyDefinition> settingsProperties)
    {
      this.SettingsId = id;
      this.DisplayName = displayName;
      this.SettingPropertyGroups = SettingsUtils.GetSettingsPropertyGroups('/', (IEnumerable<ISettingsPropertyDefinition>) settingsProperties);
    }
  }
}
